//
//  M1MemberPrerogativeCell.m
//  NewMarryU
//
//  Created by Cedar on 2018/7/20.
//  Copyright © 2018年 Cedar. All rights reserved.
//

#import "M1MemberPrerogativeCell.h"
#import "M1MemberIconCell.h"

@implementation M1MemberPrerogativeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    [self.m1_collectionView registerNib:[UINib nibWithNibName:@"M1MemberIconCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"UICollectionViewCellIdentifier"];
}

-(void)setM1_dataArray:(NSArray *)m1_dataArray{
    _m1_dataArray = m1_dataArray;
    [self.m1_collectionView reloadData];
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return _m1_dataArray.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    M1MemberIconCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"UICollectionViewCellIdentifier" forIndexPath:indexPath];
    NSDictionary *dic = _m1_dataArray[indexPath.item];
    cell.m1_coverImage.image = [UIImage imageNamed:dic[@"image"]];
    cell.m1_title.text = dic[@"title"];
    return cell;
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
    return CGSizeMake(([UIScreen mainScreen].bounds.size.width - 36 - 40) / 4, 65);
}

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
    return UIEdgeInsetsMake(0, 18, 0, 18);
}

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
    return 0;
}

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
    return 0;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
